import click
import printscreen
import image_discern
import time

###进行图标点击###
def Identify_Click(little):
    a = 0.1
    click.xunzhao()
    time.sleep(a) # 间隔秒数
    printscreen.Printscreen() # 截图
    time.sleep(a)
    b1 = image_discern.Image_Discern('yuan.png', little) #图像对比
    for i in range(1,10):
        if b1 == 0:
            print('准备再次寻找第',i,'次')
            time.sleep(a)
            click.xunzhao()
            time.sleep(a)
            printscreen.Printscreen()
            time.sleep(a)
            b1 = image_discern.Image_Discern('yuan.png', little)
        else:
            time.sleep(a)
            printscreen.Printscreen() # 截图
            b1 = image_discern.Image_Discern('yuan.png', little) #图像对比
            a1, a2 = b1 #地址赋值
            click.move_click(a1, a2) #模拟点击
            time.sleep(a)
            break

###寻找场景内是否有相应图标###
def Identify_Click_Seek(little):
    a = 0.1
    click.xunzhao()
    time.sleep(a) # 间隔秒数
    printscreen.Printscreen() # 截图
    time.sleep(a)
    b1 = image_discern.Image_Discern('yuan.png', little) #图像对比
    if b1 == 0:
        # print('没有相应图标')
        return(False)
    else:
        # print('找到相应图标')
        return(True)
